<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>yukari world</title>
<#include "/lib/base_source.ftl">
<style type="text/css">
</style>
</head>
<body>
<div class='whole-container'>
<#include "/lib/header.ftl">
    <div>
        <ul class="breadcrumb">
        	<li>地址管理</li><span class="divider">/</span>
            <li>地址列表</li>
        </ul>
    </div>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="container span12">
            <#include "/lib/alert.ftl">

                <div class='main-content'>
                    <div class="well form-inline">
                        <div class='main-action'>
                            <a href="${rc.contextPath}/admin/address/add" class="btn btn-sm btn-info">新增地址</a>
                        </div>
                    </div>
                    
                    <div class="table-content">
                    <#-- table -->
                        <table class="table table-striped table-bordered table-condensed" id="itemTable" style="font-size:12px;word-break:break-all;word-wrap:break-word;">
                            <thead>
                            <tr >
                                <th>姓名</th>
                                <th>手机</th>
                                <th>地址</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="musicList">
								<#list list as item>
								    <tr>
										<td>${item.name}</td>
										<td>${item.phone}</td>
										<td>${item.address}</td>
										<td><a href="javascript:" onclick="deleteAddress('${item.id}')" class="btn btn-sm btn-danger">删除地址</a></td>
									</tr>
								</#list>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function(){
    });
    function deleteAddress(id) {
        $.ajax({
            url : "${rc.contextPath}/admin/address/delete",
            dataType : "json",
            data :  {"id":id},
            type:'post',
            success:function(json){
                if (json.code == 0){
                    location.reload();
                } else {
                    alert("添加失败: "+json.message);
                }
            }
        });
    }

</script>
</body>
</html>